import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * User: Andrey
 * Date: 08.04.13
 * Time: 22:15
 * To change this template use File | Settings | File Templates.
 */
public class Prostue
{
    public static  void main(String[] args)
    {
        System.out.println("Ведите число до 1000:");
        Scanner console = new Scanner(System.in);
        Integer value = console.nextInt();
        System.out.print("Простие числа: " + "\n");
        find(value);
    }

    public static void find(int in)
    {
        nextPrime:
        for(int i=2; i<in; i++)
        {
            for(int j=2; j<i; j++)
            {
                if ( i % j == 0) continue nextPrime;
            }
            print(i);
        }
    }

    static void print(int i)
    {
        System.out.print(i + " ");
    }
}
